<template>
	<view class="container">
		
		<view class="" style="display: flex;flex-wrap: wrap;justify-content: space-between;">
			<view v-for="(item,index) in list" style="width: 49%;margin-bottom: 10px;" :key="index">
				<uni-card @click="to(item)">
					<swiper :indicator-dots="true" indicator-color="#ccc" indicator-active-color="#007aff">
						<swiper-item v-for="item1 in item.image">
							<view class="swiper-item">
								<image :src="item1" style="width: 100%" mode=""></image>
							</view>
						</swiper-item>
					</swiper>
					<view class="item" style="margin-top: 3px;">{{item.title}}</view>
					<view class="item" style="color: #737373;
					display: -webkit-box;
					    -webkit-box-orient: vertical;
					    overflow: hidden;
					    -webkit-line-clamp: 2;
					">
						<view class="" v-html="item.content"></view>
					</view>
					<view class="item" style="display: flex;justify-content: space-between;">
						<view class="" style="display: flex;align-items: center;">
							<!-- icon图标，内置组件中也有很多图标 -->
							<uni-icons type="heart-filled" color="red" @click="item.like++"></uni-icons>
							<view class="" style="margin-left: 2px;">{{item.like}}</view>
						</view>
						<!-- 日期格式化组件 -->
						<uni-dateformat style="font-size: 12px;color: #737373;" :date="item.time" />
					</view>
				</uni-card>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: []
			};
		},
		// 监听点击导航栏的作用
		onNavigationBarButtonTap(e) {
			uni.navigateTo({
				url: 'add/add',
				success: res => {},
				fail: () => {},
				complete: () => {}
			});
		},
		onLoad(item) {

		},
		onReady() {},
		onShow() {
			this.list = this.$request.t3
			console.log(this.list);
		},
		methods: {
			to(item) {
				uni.navigateTo({
					url: 'detail/detail?data=' + JSON.stringify(item),
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			}
		}
	};
</script>

<style lang="scss">

</style>
